import React,{useState} from 'react';
import {Button, Modal} from "antd";
import {ContentTypeComp} from "./comp/ContentTypeComp";
const showComp = text=>{
    switch(text){
        case "Content-Type":
            return <ContentTypeComp/>;
        default:
            break;
    }
}
/**
 * 点击后会有弹窗展示一些提示信息
 * @param props
 * @returns {Element}
 * @constructor
 */
const MdxToolTipComp = function (props) {
    const [isModalOpen, setIsModalOpen] = useState(false);
    const {text} = props;
    return (
        <>
            <Button onClick={() => {setIsModalOpen(true)}} type={'link'}>
                {text}
            </Button>
            <Modal
                mask={false}
                width={800}
                style={{marginRight:'20px'}}
                open={isModalOpen}
                maskClosable={false}
                onCancel={() => {setIsModalOpen(false)}}
                title={text}
                onOk={() => {setIsModalOpen(false)}}
            >
                {showComp(text)}
            </Modal>
        </>
    )

};


export default MdxToolTipComp;